package com.beiing.tianshuai.tianshuai.mine.presenter;

import com.beiing.tianshuai.tianshuai.mine.entity.OrderApplyAfterSaleBean;
import com.beiing.tianshuai.tianshuai.mine.entity.OrderApplyAfterSalePostDataBean;
import com.beiing.tianshuai.tianshuai.mine.model.OrderApplyAfterSaleModel;
import com.beiing.tianshuai.tianshuai.mine.model.OrderApplyAfterSaleModelImpl;
import com.beiing.tianshuai.tianshuai.mine.view.OrderApplyAfterSaleViewImpl;

import java.io.Serializable;
import java.util.List;

public class OrderApplyAfterSalePresenter implements OrderApplyAfterSalePresenterImpl,
        OrderApplyAfterSaleModel.OrderApplyAfterSaleDataResponseListener,
        OrderApplyAfterSaleModel.OrderApplyAfterSaleDataPostResponseListener {

    private OrderApplyAfterSaleViewImpl mView;
    private OrderApplyAfterSaleModelImpl mModel;

    public OrderApplyAfterSalePresenter(OrderApplyAfterSaleViewImpl view) {
        mView = view;
        mModel = new OrderApplyAfterSaleModel(this, this);
    }

    @Override
    public void getOrderApplyAfterSale(String mOrdersId) {
        mView.showProgress();
        mModel.getOrderApplyAfterSale(mOrdersId);
    }

    @Override
    public void postOrderApplyAfterSale(String mOrdersId, String mGoodsState, String mReturnReason,
                                        String mReturnExplain, String mReturnType, List<String> mImagesPath) {
        mView.showProgress();
        mModel.postOrderApplyAfterSale(mOrdersId,mGoodsState,mReturnReason,mReturnExplain,mReturnType,mImagesPath);
    }

    @Override
    public void onGetDetailSuccess(OrderApplyAfterSaleBean bean) {
        //请求数据成功返回
        mView.hideProgress();
        mView.getOrderApplyAfterSaleSuccess(bean);

    }

    @Override
    public void onGetDetailError(Throwable throwable) {
        //失败
        mView.getOrderApplyAfterSaleError(throwable);
    }

    @Override
    public void onPostDetailSuccess(OrderApplyAfterSalePostDataBean bean) {
       //添加数据成功返回
        mView.hideProgress();
        mView.postOrderApplyAfterSaleInfoSuccess(bean);
    }

    @Override
    public void onPostDetailError(Throwable throwable) {

    }
}
